package com.zbkj.front.controller.user;

import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.brand.BrandRequest;
import com.zbkj.common.response.BrandPageResponse;
import com.zbkj.common.result.CommonResult;
import com.zbkj.service.service.BrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("api/front/platform/brand")
@Api(tags = "商品分类控制器")
public class PlatformBrandController {

    @Autowired
    private BrandService brandService;


    @ApiOperation(value = "所有已开启的品牌商列表")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public CommonResult<CommonPage<BrandPageResponse>> getPageList(@Validated PageParamRequest pageParamRequest) {
        BrandRequest searchRequest = new BrandRequest();
        searchRequest.setIsSwitch(true);
        return CommonResult.success(CommonPage.restPage(brandService.getAdminPage(searchRequest, pageParamRequest)));
    }
}
